<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>导航编辑</title>
<link rel="stylesheet"
	href="${basePath }/admin/bower_components/bootstrap/dist/css/bootstrap.min.css">
	<link rel="stylesheet"
	href="${request.contextPath}/admin/plugins/bootstrap-fileinput/css/fileinput.min.css">
	 <script src="${basePath }/admin/bower_components/ckeditor/ckeditor.js"></script>

		<script type="text/javascript">
		    window.onload = function()
		    {
		        CKEDITOR.replace( 'description');
		    };
		</script>
</head>
<body>
	<form class="form-horizontal" action="${basePath }/admin/editMovie.action"
		method="post">
		
			<input type="hidden" name="id" value="${movie.id }">
		
		<div class="form-group">
			<label for="InputName" class="col-sm-2 control-label">电影名称</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.name }"
					id="InputName" name="name" placeholder="电影名称">
			</div>
		</div>
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">年份</label>
			<div class="col-sm-10">
			<#if movie.year??>
				<input type="text" class="form-control" value="${movie.year?c }"
					id="InputContent" name="year" placeholder="年份">
					<#else>
				<input type="text" class="form-control" value="${movie.year }"
					id="InputContent" name="year" placeholder="年份">
			</#if>
			
			
			</div>
		</div>
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">类型</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.type }"
					id="InputContent" name="type" placeholder="类型">
			</div>
		</div>
		<div class="form-group">
				<label for="inputImageUrl" class="col-sm-2 control-label">图片地址</label>
				<div class="col-sm-10 ">
					<input type="text" class="form-control" id="inputImageUrl"
						name="image" placeholder="图片地址,不上传将使用默认图片"
						value="${(movie.image)!''}" readonly="readonly">
				</div>
				
			</div>
			
			<div class="form-group">
				<label for="inputCateType" class="col-sm-2 control-label">上传图片</label>
				<div class="col-sm-10">
					<input  id="input-id" type="file"
						class="file file-loading">
	
				</div>
			</div>
			<div class="form-group">
					<label for="inputWidth" class="col-sm-2 control-label">图片宽高</label>
					<div class="col-sm-10 form-inline">
						<input type="number" class="form-control" required="required"
							id="inputWidth" name="width" placeholder="输入图片宽度"
							value="${(album.width)!'100'}"> <input type="number"
							class="form-control" required="required" id="inputHeight"
							name="height" placeholder="输入图片高度"
							value="${(album.height)!'100'}">

						<div class="radio">
							<label> <input type="radio" name="optionsRadios"
								id="optionsRadios1" value="200"> 200X200
							</label>
						</div>
						<div class="radio">
							<label> <input type="radio" name="optionsRadios"
								id="optionsRadios2" value="700"> 700X450
							</label>
						</div>


					</div>
				</div>
				
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">演员</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.actor }"
					id="InputContent" name="actor" placeholder="演员">
			</div>
		</div>
		
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">导演</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.director }"
					id="InputContent" name="director" placeholder="导演">
			</div>
		</div>
		
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">时长</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.time }"
					id="InputContent" name="time" placeholder="时长">
			</div>
		</div>
		
		<div class="form-group">
			<label for="InputContent" class="col-sm-2 control-label">内容</label>
			<div class="col-sm-10">
			<textarea name="content" id="description" placeholder="剧情介绍"/>${movie.content }</textarea>
			</div>
		</div>
		<div class="form-group">
			<label for="InputUrl" class="col-sm-2 control-label">链接地址</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="${movie.url }"
					id="InputUrl" name="url" placeholder="链接地址">
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-default">提交</button>
			</div>
		</div>
	</form>
<!-- jQuery 3 -->
	<!-- jQuery 3 -->
	<script
		src="${request.contextPath}/admin/bower_components/jquery/dist/jquery.min.js"></script>
	<!-- piexif  -->
	<script
		src="${request.contextPath}/admin/plugins/bootstrap-fileinput/js/plugins/piexif.min.js"></script>

	<!-- purify  -->
	<script
		src="${request.contextPath}/admin/plugins/bootstrap-fileinput/js/plugins/purify.min.js"></script>

	<!-- fileinput  -->
	<script
		src="${request.contextPath}/admin/plugins/bootstrap-fileinput/js/fileinput.min.js"></script>

	<!-- Bootstrap 3.3.7 -->
	<script
		src="${request.contextPath}/admin/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

	<!-- fileinput  -->
	<script
		src="${request.contextPath}/admin/plugins/bootstrap-fileinput/js/locales/zh.js"></script>
	<script type="text/javascript">
	    var obj=$("#input-id");
	    var option={}
	    option.uploadUrl="/file/uploadimageone";
		option.uploadAsync=true;
		option.language="zh";
		option.showCaption=true;
		option.showUpload=true;
		option.showRemove=true;
		option.showPreview=true;
		option.resizeImage=true;
		option.resizePreference='width';
		option.browseClass="btn btn-primary";
		option.uploadLabel="上传";
		option.enctype="multipart/form-data";
		option.dropZoneEnabled= false;
		option.allowedFileExtensions=[ "png", "jpg", "gif" ];
		option.maxFileCount=5;
		$("#inputWidth").blur(function() {

			width= $("#inputWidth").val();
			obj.fileinput('refresh', {maxImageWidth: width})
			
			if (isEmpty(width)) {
				return;
			}
		})
		$("#inputHeight").blur(function() {
			height= $("#inputHeight").val();
			
			obj.fileinput('refresh', {maxImageHeight: height})
			if (isEmpty(height)) {
				return;
			}
		})

		$(":radio").click(function(e) {
			if (e.target.defaultValue == 200) {
				
				
				obj.fileinput('refresh', {maxImageHeight: 200,maxImageWidth: 200})
				
				
				$("#inputWidth").val(200)
				$("#inputHeight").val(200)

			}
			if (e.target.defaultValue == 700) {
			
				obj.fileinput('refresh', {maxImageHeight: 450,maxImageWidth: 700})
				$("#inputWidth").val(700)
				$("#inputHeight").val(450)

			}
		});

		//with plugin options
		
		
		obj.fileinput(option/* {
			uploadUrl : "/file/uploadimageone",//上传的地址
			uploadAsync : true, //异步上传
			language : "zh", //设置语言
			showCaption : true, //是否显示标题
			showUpload : false, //是否显示上传按钮
			showRemove : true, //是否显示移除按钮
			showPreview : true, //是否显示预览按钮
			resizeImage : true, //调整图片的宽度
			maxImageWidth : 200,
			maxImageHeight : 200,
			resizePreference : 'width',
			browseClass : "btn btn-primary", //按钮样式
			uploadLabel : "上传", //设置上传按钮的汉字
			enctype : 'multipart/form-data',
			dropZoneEnabled : false, //是否显示拖拽区域
			allowedFileExtensions : [ "png", "jpg", "gif" ], //接收的文件后缀
			maxFileCount : 5

		} */).on("fileuploaded", function(event, data) {
			var response = data.response;
			if (response.uploaded == 1) {

				$("#inputImageUrl").val(response.url)

			} else {
				alert("文件上传失败")
			}

			console.log(response);

		}).on('fileerror', function(event, data, msg) { //一个文件上传失败
			alert('文件上传失败！' + msg);
		
		
		}).on("filebatchselected", function(event, files) {
			console.log(files)
		}).on('fileselect', function(event, numFiles, label) {
		
	        
	    });;

		function isEmpty(obj) {
			if (typeof obj == "undefined" || obj == null || obj == "") {
				return true;
			} else {
				return false;
			}
		}
		
	</script>
</body>
</html>